import { getAction } from '@api/manage'
import Api from '@api/CashManage/FundsWithdrawal'

export const RefundMixin = {
  data() {
    return {}
  },
  created() {},
  methods: {
    wechatUserRefund(id, type) {
      const that = this
      let url
      if (type === 1) {
        // 在线订单押金退款
        url = Api.onlineOrdersRrefund
      } else if (type === 2) {
        // 在线订单押金退款
        url = Api.orderCashRrefund
      } else if (type === 3) {
        // 在线订单押金退款
        url = Api.memberManageRrefund
      }
      that.$confirm({
        title: '退款',
        content: '确定要退款吗 ',
        onOk: function() {
          const data = {
            id
          }
          getAction(url, data).then(res => {
            if (res.success) {
              that.$message.success(res.message)
              that.loadData()
            } else {
              that.$message.warning(res.message)
            }
          })
        }
      })
    }
  }
}

